package com.easthome.process.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.metadata.OrderItem;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.easthome.common.result.Result;
import com.easthome.process.service.ProcessService;
import com.easthome.vo.process.ProcessQueryVo;
import com.easthome.vo.process.ProcessVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @description:
 * @author: 朱敦宇
 * @time: 2023/11/16 11:22
 */
@Api(tags = "审批管理")
@RestController
@RequestMapping("/admin/process")
public class ProcessController {
    @Autowired
    private ProcessService processService;

    @ApiOperation("审批管理分页查找")
    @GetMapping("/{page}/{limit}")
    public Result getPageList(@PathVariable("page") Long page,
                              @PathVariable("limit") Long limit,
                              ProcessQueryVo vo){

        Page<ProcessVo> processVoPage = new Page<>(page, limit);
//        processVoPage.addOrder(new OrderItem("create_time",false));
        IPage<ProcessVo> voIPage = processService.getPageList(processVoPage,vo);

        return Result.ok(voIPage);
    }

}
